Inside Macintosh: QuickTime

Previous | Chapter Top | Chapter Contents | Next

Locating a Movie's Tracks and Media Structures

The Movie Toolbox provides a set of functions that help your application locate a movie's tracks and media structures. This section describes these functions.

The Movie Toolbox identifies a movie's tracks in two ways. First, every track in a movie has a unique ID value. This ID value is unique throughout the life of a movie, even after it has been saved. That is, no two tracks of a movie ever have the same ID, and no ID value is ever reused. Second, a movie's current tracks may be identified by their index value. Index values always range from 1 to the number of tracks in the movie. Track indexes provide a convenient way to access each track of a movie.

There are several functions that allow you to find a movie's tracks. You can use the GetMovieTrackCount function to determine the number of tracks in a movie. Use the  GetMovieTrack function to obtain the track identifier for a specific track, given its ID. The GetMovieIndTrack function lets you obtain a track's identifier, given its track index.

You can obtain a track's ID value given its track identifier by calling the GetTrackID function.

You can determine the movie that contains a track by calling the GetTrackMovie function.

The GetTrackMedia function enables you to find a track's media. Conversely, you can find the track that uses a media by calling the GetMediaTrack function.

GetMovieTrackCount

The GetMovieTrackCount function returns the number of tracks in a movie.

pascal long GetMovieTrackCount (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

GetMovieIndTrack

The GetMovieIndTrack function allows your application to determine the track identifier of a track given the track's index value. The index value identifies the track among all current tracks in a movie. Index values range from 1 to the number of tracks in the movie.

pascal Track GetMovieIndTrack (Movie theMovie, long index);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).
index
Specifies the index value of the track for this operation.

DESCRIPTION

The GetMovieIndTrack function returns the track identifier that is appropriate to the specified track. If the function cannot locate the track, it sets this returned value to nil .

ERROR CODES

badTrackIndex

-2028

This track index value is not valid

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can determine the number of tracks in a movie by calling the GetMovieTrackCount function, which is described in the previous section.

GetMovieTrack

The GetMovieTrack function allows your application to determine the track identifier of a track given the track's ID value.

pascal Track GetMovieTrack (Movie theMovie, long trackID);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).
trackID
Specifies the ID value of the track for this operation.

DESCRIPTION

The GetMovieTrack function returns the track identifier that is appropriate to the specified track. If the function cannot locate the track, it sets this returned value to nil .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

trackIDNotFound

-2029

Cannot locate a track with this ID value

SEE ALSO

You can obtain a track's ID value by calling the GetTrackID function, which is described in the next section. You can use a track's index value to obtain its track identifier by calling the GetMovieIndTrack function, which is described in the previous section.

GetTrackID

The GetTrackID function allows your application to determine a track's unique track ID value. This ID value remains unique throughout the life of the movie.

pascal long GetTrackID (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackID function returns the track's ID value. If the function could not determine the ID value, it sets this returned value to 0.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

GetTrackMovie

The GetTrackMovie function allows you to determine the movie that contains a specified track.

pascal Movie GetTrackMovie (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackMovie function returns the movie identifier that corresponds to the movie that contains the track. If the function could not locate the movie, it sets this returned value to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

GetTrackMedia

The GetTrackMedia function allows you to determine the media that contains a track's sample data.

pascal Media GetTrackMedia (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackMedia function returns the media identifier that corresponds to the media that specifies the track's sample data. If the function could not locate the media, it sets this returned value to nil .

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

GetMediaTrack

The GetMediaTrack function allows you to determine the track that uses a specified media.

pascal Track GetMediaTrack (Media theMedia);
theMedia
Specifies the media for this operation. Your application obtains this media identifier from such Movie Toolbox functions as NewTrackMedia and GetTrackMedia (described on NewTrackMedia and GetTrackMedia , respectively).

DESCRIPTION

The GetMediaTrack function returns the track identifier of the track that uses the media. If the function cannot determine the track that uses the media, it sets this value to nil .

ERROR CODES

invalidMedia

-2008

This media is corrupted or invalid


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next